import 'package:check_app/scoped_model/app_model.dart';
import 'package:flutter/material.dart';
import 'package:scoped_model/scoped_model.dart';

class NoSignal extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => new NoSignalState();
}

class NoSignalState extends State<NoSignal> {
  @override
  void initState() {
    super.initState();
  }

  @override
  dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return ScopedModelDescendant<GlobalModel>(
      rebuildOnChange: true, //改变的时候是否重建
      builder: (context, _, model) =>
          model.connectionStatus == 'ConnectivityResult.none'
              ? Container(
                  padding: EdgeInsets.only(
                    left: 16,
                  ),
                  height: 32,
                  color: Color.fromRGBO(255, 240, 214, 1),
                  child: Row(
                    children: <Widget>[
                      Container(
                        padding: EdgeInsets.only(
                          right: 6,
                        ),
                        child: Image(
                          image: AssetImage('assets/images/no_signal.png'),
                          width: 14,
                          height: 14,
                        ),
                      ),
                      Text(
                        '无网络连接，请检查你的网络',
                        style: TextStyle(
                          color: Color.fromRGBO(239, 145, 5, 1),
                          height: 16 / 12,
                          fontSize: 12,
                        ),
                      ),
                    ],
                  ),
                )
              : SizedBox(),
    );
  }
}
